﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;

using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Windows.Data;

namespace ProjManagSolution
{
    public class Tree
    {
        public string Value { get; set; }
        public Tree Parent { get; set; }
        public List<Tree> Children;
        public int Depth { get { return Parent == null ? 0 : Parent.Depth + 1; } }

        public Tree()
        {
            Value = string.Empty;
            Parent = null;
            Children = new List<Tree>();
        }

        public Tree CreateChild(string value)
        {
            Tree child = new Tree() { Value = value, Parent = this };
            Children.Add(child);
            return child;
        }
    }
}
